package com.kun.service.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import com.kun.entity.User;
import com.kun.service.IUserRedisService;
import com.kun.util.IRedisService;

@Service
public class UserRedisServiceImpl extends IRedisService<User> implements IUserRedisService{
    
    private static final String USER_REDIS_KEY = "USER_REDIS_KEY";
    
    @Override
    protected String getRedisKey() {
        return USER_REDIS_KEY;
    }

    @Override
    public void saveUsers(List<User> users) {
        for (User user : users) {
            put(user.getId(), user, -1);
        }
    }

    @Override
    public List<User> findAll() {
        return getAll();
    }

    @Override
    public User findById(String id) {
        return get(id);
    }

    @Override
    public void deleteById(String id) {
        remove(id);
    }


}